package com.qf.service.impl;

import com.qf.dao.StudentDao;
import com.qf.dao.impl.StudentDaoImpl;
import com.qf.pojo.Student;
import com.qf.service.StudentService;

import java.util.List;

public class StudentServiceImpl implements StudentService {
    @Override
    public List<Student> findAll() {
        StudentDao studentDao=new StudentDaoImpl();

          return studentDao.findAll();
    }
@Override
    public boolean insertStudent(Student student) {
        StudentDao studentDao=new StudentDaoImpl();
        int count=studentDao.insertStudent(student);
        if(count>0){
        return true;
        }else {
        return false;
    }}

    @Override
    public Student findById(Integer id) {
        StudentDao studentDao = new StudentDaoImpl();
        Student student = studentDao.findById(id);
        return student;
    }

    @Override
    public boolean deleteById(Integer id) {
        StudentDao studentDao = new StudentDaoImpl();
        Integer count = studentDao.deleteById(id);
        if (count>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean updateStudent(Student student) {
        StudentDao studentDao = new StudentDaoImpl();
        Integer count = studentDao.updateById(student);
        if (count>0){
            return true;
        }else {
            return false;
        }
    }
    }

